//
//  CollectionTableViewCell.m
//  远方
//
//  Created by 1564335 on 15-6-7.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "CollectionTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation CollectionTableViewCell

- (void)dealloc
{
    [_title release];
    [_titleImage release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.title = [[UILabel alloc] init];
        self.titleImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.titleImage];
        [self.contentView addSubview:self.title];
        [self.title release];
        [self.titleImage release];
    }
    return self;
}

- (void)layoutSubviews
{
    self.titleImage.frame = CGRectMake(10, 0, self.contentView.frame.size.height + 20, self.contentView.frame.size.height);
    self.title.frame = CGRectMake(self.contentView.frame.size.height + 40, 0, self.contentView.frame.size.width - 70, self.contentView.frame.size.height);
    self.title.font = [UIFont systemFontOfSize:15];
}

- (void)setDbModel:(DbModel *)dbModel
{
    self.title.text = dbModel.title;
    [self.titleImage setImageWithURL:[NSURL URLWithString:dbModel.imageURL] placeholderImage:[UIImage imageNamed:@"place_holder.jpg"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
